/*
 * NewGoodsActivity.java
 * business
 *
 * Created by ChenTao on 2016/9/9.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */

package com.yidiandao.business.ui.newgoods;

import android.app.Activity;
import android.content.Intent;

import com.yidiandao.business.R;
import com.yidiandao.business.base.BaseActivity;
import com.yidiandao.business.data.model.HomeModel;
import com.yidiandao.business.utils.ActivityUtils;

/** 首页 - 最新商品 */
public class NewGoodsActivity extends BaseActivity {

    private NewGoodsFragment mNewGoodsFragment;

    public static void actionStart(Activity activity) {
        Intent intent = new Intent(activity, NewGoodsActivity.class);
        activity.startActivity(intent);
    }

    @Override
    protected void initFragment() {
        mNewGoodsFragment =
                (NewGoodsFragment)
                        getSupportFragmentManager().findFragmentById(R.id.container_new_goods);
        if (mNewGoodsFragment == null) {
            mNewGoodsFragment = NewGoodsFragment.getInstance();
            ActivityUtils.addFragmentToActivity(
                    getSupportFragmentManager(), mNewGoodsFragment, R.id.container_new_goods);
        }
    }

    @Override
    protected void initPresenter() {
        new NewGoodsPresenter(mNewGoodsFragment, new HomeModel());
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_new_goods;
    }
}
